#ifndef __MQTT_H__
#define __MQTT_H__

#include "esp_event.h"
#include "mqtt_client.h"
#include "esp_log.h"

#include<freertos/FreeRTOS.h>
#include<freertos/task.h>
#include <cJSON.h>
#include "common.h"
#include"esp_system.h"
#include<freertos/queue.h>
#include "esp_http_client.h"
#include"esp_spiffs.h"
#include"ymodem.h"
static const char *MQTT_TAG = "MQTT";

static const char* xQueue_Consumer_TAG="xQueue_Consumer_TAG";

#define MQTT_ADDRESS   "mqtt://120.92.100.208:1883"
#define MQTT_CLIENT_ID  "esp32"
#define MQTT_SEND_TOPIC "/esp32/server"
#define MQTT_RCV_TOPIC   "/esp32/client"

 
 

 static esp_mqtt_client_handle_t client;

void mqtt_app_start(void);

void mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_t event_id, void *event_data);

void log_error_if_nonzero(const char *message, int error_code);

void mqtt_data_parse(char* data,size_t size,MQTT_MESSAGE* message);

void queueConsumerTask(void* pvParameters);

esp_err_t http_event_handler(esp_http_client_event_t *evt);

#endif